package cn.j0n4than.api.controller.api.admin;

import cn.j0n4than.api.entity.Admin;
import cn.j0n4than.api.entity.Auth;
import cn.j0n4than.api.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * @author jonathan
 */
@Controller
public class AdminBaseController {

    @Autowired
    AdminService adminService;

    /**
     * 获取当前用户
     *
     * @param auth Token内容
     * @return 当前用户
     */
    protected Admin getCurrentUser(Auth auth) {
        return adminService.findAdminById(auth.userId);
    }
}
